import axios from '../../axios';

const adminApi = {
    login: function (params) {
        return axios({
            url: "admins/login",
            method: "post",
            data: params
        });
    },
    isLogin: function () {
        return axios({
            url: "/admins/islogin",
            method: "post"
        })
    },
    addAdmins: function (params) {
        return axios({
            url: "/admins/addAdmins",
            method: 'post',
            data: {
                adminName: params.adminName,
                password: params.password,
                power: 1,
                state: "common"
            }
        })
    },
    getAdmins: function () {
        return axios({
            url: '/admins/getAdmins'
        })
    },
    deleteAdmins: function (params) {
        return axios({
            url: '/admins/deleteAdmins',
            method: "post",
            data: {
                _id:params
            }
        })
    },
    updataAdmins:function (params) { 
        return axios({
            url:"/admins/updataAdmins",
            method:'post',
            data:{
                _id:params._id,
                adminName: params.adminName,
                password: params.password,
                state: params.state
            }
        })
     }
}

export default adminApi;